/****************************************************************************/    
/* NAME:           Hal_PwmManagement.h                                      */    
/* PURPOSE:        Osmolator management                                     */    
/* CREATED_BY:     Vyx                                                      */    
/* CREATION_DATE:  09/07/2012                                               */    
/************************************** (C) Copyright 2012 AquaLink *********/ 

#ifndef PWM_MANAGEMENT_DEF
#define PWM_MANAGEMENT_DEF

#include "Hal_GenericConfig.h"
#include "stm32f10x.h"
#include "stm32_config.h"

/* OutputName                     */
/* Add your output in this table */
#ifdef STM32_CONFIG_1 /* STM32_CONFIG_1 */

    #define OSCILLATOR_1 0
    #define OSCILLATOR_2 1
    #define LEDSPWM_1    2
    #define LEDSPWM_2    3
    #define LEDSPWM_3    4
    #define FANSPWM_1    5

#endif /* STM32_CONFIG_1 */

#ifdef STM32_CONFIG_2 /* STM32_CONFIG_2 */

    #define OSCILLATOR_1 0
    #define OSCILLATOR_2 1
    #define LEDSPWM_1    2
    #define LEDSPWM_2    3
    #define LEDSPWM_3    4
    #define LEDSPWM_4    5
    #define LEDSPWM_5    6
    #define LEDSPWM_6    7
    #define LEDSPWM_7    8

#endif /* STM32_CONFIG_2 */

typedef enum
{
  CHANNEL_1 = 0,
  CHANNEL_2,
  CHANNEL_3,
  CHANNEL_4
}Channel_def_t;

typedef struct
{
  TIM_TypeDef      *TimName;
  Channel_def_t     Channel;
  uint16_t          Frequency;
  uint16_t          DutyCycle;
}Pwm_def_t;

/**    
  * @brief  Main function of output management.  
  *         This function is execute one time at the start.
  * @param  none    
  * @retval None    
  */  
void vTaskCTRL_PwmManagementInit(void);

/**    
  * @brief  Get the value of selected input.    
  * @param  DutyCycleValue in percent (raw value (0-1000), physical value (0.1-100%), resolution 0.1%)
  * @retval Value of input (TRUE or FALSE)
  */  
void PWM_SetPwmValue(uint8_t PwmName, uint16_t DutyCycleValue);

#endif /* PWM_MANAGEMENT_DEF */


